package com.bdqn.zhang.controller;

import com.bdqn.zhang.service.DeptService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;

@Controller
@RequestMapping("/dept")
public class DeptController {

    @Resource
    private DeptService deptService;

    @RequestMapping("/getOne/{id}")
    public String getDeptNameById(@PathVariable("id") Integer id, Model model){
        String name = deptService.getDeptNameById(id);
        model.addAttribute("name",name);
        return "index";
    }

}
